package ICM.client;

import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.LineBorder;


import common.CommandMessage;
import common.User;

import ICM.server.DBManager;
import java.awt.GridLayout;

public class StudentWindow extends JPanel implements ActionListener{
	
	private Client client;
	private ClientUI ui;
	private JButton btnChangeRequest;
	private ChangeRequest cr;
	
	public StudentWindow(Client client, ClientUI ui) {
		this.client=client;
		this.ui=ui;
		
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.rowWeights = new double[]{1.0};
		gridBagLayout.columnWeights = new double[]{1.0};
		setLayout(gridBagLayout);
		
		JPanel panel = new JPanel();
		GridBagConstraints gbc_panel = new GridBagConstraints();
		gbc_panel.fill = GridBagConstraints.BOTH;
		gbc_panel.gridx = 0;
		gbc_panel.gridy = 0;
		add(panel, gbc_panel);
		GridBagLayout gbl_panel = new GridBagLayout();
		gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		gbl_panel.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0};
		gbl_panel.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		panel.setLayout(gbl_panel);
		
		JLabel lblWelcome = new JLabel("Welcome");
		lblWelcome.setFont(new Font("Tahoma", Font.PLAIN, 18));
		GridBagConstraints gbc_lblWelcome = new GridBagConstraints();
		gbc_lblWelcome.insets = new Insets(0, 0, 5, 5);
		gbc_lblWelcome.fill = GridBagConstraints.HORIZONTAL;
		gbc_lblWelcome.gridwidth = 4;
		gbc_lblWelcome.gridheight = 3;
		gbc_lblWelcome.gridx = 5;
		gbc_lblWelcome.gridy = 0;
		panel.add(lblWelcome, gbc_lblWelcome);
		
		btnChangeRequest = new JButton("Change Request");
		//btnChangeRequest.addActionListener(this) ;
		
		btnChangeRequest.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				setContentPane(cr);					
			}
		});
		
		GridBagConstraints gbc_btnChangeRequest = new GridBagConstraints();
		gbc_btnChangeRequest.gridwidth = 2;
		gbc_btnChangeRequest.insets = new Insets(0, 0, 0, 5);
		gbc_btnChangeRequest.gridx = 3;
		gbc_btnChangeRequest.gridy = 5;
		panel.add(btnChangeRequest, gbc_btnChangeRequest);
		
		JButton btnMonitorRequest = new JButton("Monitor Request");
		GridBagConstraints gbc_btnMonitorRequest = new GridBagConstraints();
		gbc_btnMonitorRequest.insets = new Insets(0, 0, 0, 5);
		gbc_btnMonitorRequest.gridx = 10;
		gbc_btnMonitorRequest.gridy = 5;
		panel.add(btnMonitorRequest, gbc_btnMonitorRequest);
	}

	public String getRole()
	{
		User user = ui.getUser();
		return user.getRole();
		
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		
		
	}
}
